Read more link with HTML code
Read more link with HTML code
am 07.05.2007 13:28:16 von Mike van Hoof
Hello list,
I got a problem with displaying content in a "read more block" which
contains HTML code.
The problem is as followes:
I got a large piece of content, which contains HTML code (
etc), but after 200 characters a read more link appears. At the moment I
strip al the HTML out of this piece of content, and display the full set
off content on another page.
But now i also want to display the bold text etc. in the first (200
chrs) content block. The only problem i have here, is that when I got a
bold tag opend in the first 200 chrs, and it's closed after 400 chrs,
then the rest off the page is also bold.
somebody got a solution ?
Thanks for reading.
Mike
--
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024
fax: 040-29 63 567
url: www.medusa.nl
mail: mike@medusa.nl
Uw bedrijf voor Multimedia op Maat
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Read more link with HTML code
am 07.05.2007 16:21:57 von James Gadrow
Hmmm... Perhaps you should think about separating the tags from the
content? Do something like:
//Strip tags from content and add a few char hook to be used for
re-insertion
//Count 200 chars (ignoring any hooks found while parsing and thereby
not adding it to the char count)
//Make sure last char is a space or something appropriate
//re-insert tags over the hooks (count tags used & tags closed)
//close any inserted tags that aren't closed already in nested order
Mike van Hoof wrote:
> Hello list,
>
> I got a problem with displaying content in a "read more block" which
> contains HTML code.
> The problem is as followes:
>
> I got a large piece of content, which contains HTML code (
> etc), but after 200 characters a read more link appears. At the moment
> I strip al the HTML out of this piece of content, and display the full
> set off content on another page.
> But now i also want to display the bold text etc. in the first (200
> chrs) content block. The only problem i have here, is that when I got
> a bold tag opend in the first 200 chrs, and it's closed after 400
> chrs, then the rest off the page is also bold.
>
> somebody got a solution ?
>
> Thanks for reading.
>
> Mike
>
--
Thanks,
Jim
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Read more link with HTML code
am 08.05.2007 02:26:40 von itoctopus
Put your 200 characters in a table block:
--
itoctopus - http://www.itoctopus.com
"Mike van Hoof" wrote in message
news:463F0D50.9010803@medusa.nl...
> Hello list,
>
> I got a problem with displaying content in a "read more block" which
> contains HTML code.
> The problem is as followes:
>
> I got a large piece of content, which contains HTML code ( etc),
> but after 200 characters a read more link appears. At the moment I strip
> al the HTML out of this piece of content, and display the full set off
> content on another page.
> But now i also want to display the bold text etc. in the first (200 chrs)
> content block. The only problem i have here, is that when I got a bold tag
> opend in the first 200 chrs, and it's closed after 400 chrs, then the rest
> off the page is also bold.
>
> somebody got a solution ?
>
> Thanks for reading.
>
> Mike
>
> --
> Medusa, Media Usage Advice B.V.
> Science Park Eindhoven 5216
> 5692 EG SON
> tel: 040-24 57 024 fax: 040-29 63 567
> url: www.medusa.nl
> mail: mike@medusa.nl
>
> Uw bedrijf voor Multimedia op Maat
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: Read more link with HTML code
am 08.05.2007 02:41:15 von dmagick
itoctopus wrote:
> Put your 200 characters in a table block:
>
>
>
> Your 200 characters
> |
>
>
>
How is that going to help?
It's still going to have a or tag in there which is going to
flow to the next section.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: Read more link with HTML code
am 08.05.2007 08:19:01 von bedul
i prefer u use the prefix.. but it very advance..
can u spesific more.. client able to type what tag (u must consider lock
other than what u type earlier)
anyway.. using a table is a good idea.. actualy if your client type using
table.. what should u do??
----- Original Message -----
From: "itoctopus"
To:
Sent: Tuesday, May 08, 2007 7:26 AM
Subject: [PHP-DB] Re: Read more link with HTML code
> Put your 200 characters in a table block:
>
>
>
> Your 200 characters
> |
>
>
>
> --
> itoctopus - http://www.itoctopus.com
> "Mike van Hoof" wrote in message
> news:463F0D50.9010803@medusa.nl...
> > Hello list,
> >
> > I got a problem with displaying content in a "read more block" which
> > contains HTML code.
> > The problem is as followes:
> >
> > I got a large piece of content, which contains HTML code (
etc),
> > but after 200 characters a read more link appears. At the moment I strip
> > al the HTML out of this piece of content, and display the full set off
> > content on another page.
> > But now i also want to display the bold text etc. in the first (200
chrs)
> > content block. The only problem i have here, is that when I got a bold
tag
> > opend in the first 200 chrs, and it's closed after 400 chrs, then the
rest
> > off the page is also bold.
> >
> > somebody got a solution ?
> >
> > Thanks for reading.
> >
> > Mike
> >
> > --
> > Medusa, Media Usage Advice B.V.
> > Science Park Eindhoven 5216
> > 5692 EG SON
> > tel: 040-24 57 024 fax: 040-29 63 567
> > url: www.medusa.nl
> > mail: mike@medusa.nl
> >
> > Uw bedrijf voor Multimedia op Maat
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Read more link with HTML code
am 08.05.2007 08:47:13 von Mike van Hoof
--------------050003000607020001040108
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Hello:
EG:
The community of Gbongay, Sierra Leone, suffered greatly after the cou=
ntry's civil war, and had aspirations of starting a beekeeping operation =
to improve their situation. That's when they turned to NABUUR for assista=
nce. But with Neighbours living all over the world and a Facilitator with=
no knowledge of bees, could this dream ever become a reality?
<=
br />The challenge
Gbongay, a rural village situated in south=
east Sierra Leone, lost everything after the civil war -- the school and =
hospital were destroyed, and its inhabitants no longer had access to safe=
water. To try to overcome this tragedy, the community decided it needed =
to raise money, which could be used to create a small, sustainable busine=
ss.
Beekeeping seemed to be a promising option, since it requi=
red only a small investment and had the potential for a high return -- an=
d the proof was in the neighbouring village, which already had a successf=
ul honey business.
A real leader
What really got t=
his project started was the project's Facilitator, Raul Alberto Caceres. =
Born in Colombia, Raul moved to Australia for a post-graduate programme. =
He now works as a chemical engineer
in the food industry and recentl=
y joined NABUUR.
As the leader of the beekeeping project, Raul=
designed a detailed plan. He knew they needed to research as much as pos=
sible about starting and running a beekeeping operation, and that the ass=
istance of the
Neighbours was going to be essential.
The =
Neighbours -- from more than ten countries -- were involved at different =
stages of the project depending on their expertise. Some
volunteers =
helped with general tasks, like Internet research, letter writing and con=
tacting organisations for information, while others helped with more spec=
ific assignments that pertained to beekeeping
itself.
=
Quick success
Gbongay's beekeeping operation progressed quickly =
-- and it couldn't have been done without Raul's impressive leadership ab=
ilities. He showed enthusiasm on the website and was able to mobilise
/>volunteers all over the world, including Turkey, Ghana, Canada and the =
Netherlands. Because NABUUR volunteers often never have the chance to mee=
t in person, it's essential that a project's Facilitator be an organised =
and enthusiastic leader. Fortunately for the community of Gbongay, Raul w=
as just that!
Beekeeping today
www.nabuur.com/uploads/img_4512900141172.jpg" align=3D"right" hspace=3D"1=
5" alt=3D"" />The beekeeping operation in Gbongay has further expanded an=
d now includes a beekeeping school. After some research, the Neighbours a=
nd local community decided this would be a great way to
ensure the f=
uture of the beekeeping business. In March 2006, everyone began work on t=
he school.
Today, things are looking better for the village of=
Gbongay. The community's first water pump has been installed, the first =
35 beekeepers have graduated from the new school -- and, best of all,
/>the first customers are buying honey!
Bonus
"Gbo=
ngay has been rewarded by nature. It was
given the local bee, which =
is extremely prolific, an
abundance of bee flora and a favourable cl=
imate
for beekeeping -- making this initiative a lucrative
one.=
"
Mariama Fawundu, Local Representative
With kind regards
Mike
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024 =20
fax: 040-29 63 567
url: www.medusa.nl
mail: mike@medusa.nl
=20
Uw bedrijf voor Multimedia op Maat
Rafael Costa Pimenta schreef:
> could you show some example?
>
> 2007/5/7, Mike van Hoof >:
>
> Hello list,
>
> I got a problem with displaying content in a "read more block" whic=
h
> contains HTML code.
> The problem is as followes:
>
> I got a large piece of content, which contains HTML code (=
> etc), but after 200 characters a read more link appears. At the
> moment I
> strip al the HTML out of this piece of content, and display the
> full set
> off content on another page.
> But now i also want to display the bold text etc. in the first (200=
> chrs) content block. The only problem i have here, is that when I
> got a
> bold tag opend in the first 200 chrs, and it's closed after 400 chr=
s,
> then the rest off the page is also bold.
>
> somebody got a solution ?
>
> Thanks for reading.
>
> Mike
>
> --
> Medusa, Media Usage Advice B.V.
> Science Park Eindhoven 5216
> 5692 EG SON
> tel: 040-24 57 024
> fax: 040-29 63 567
> url: www.medusa.nl
> mail: mike@medusa.nl
>
> Uw bedrijf voor Multimedia op Maat
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --=20
> Atenciosamente,
> Rafael C. Pimenta
> Programador - CTT Integration Group=20
--------------050003000607020001040108--
Re: Re: Read more link with HTML code
am 08.05.2007 09:05:40 von Mike van Hoof
--------------020407050801050007000306
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hey,
a client can type anything in the field, so all kind of HTML tags can be
inserted...
- Mike
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024
fax: 040-29 63 567
url: www.medusa.nl
mail: mike@medusa.nl
Uw bedrijf voor Multimedia op Maat
bedul schreef:
> i prefer u use the prefix.. but it very advance..
>
> can u spesific more.. client able to type what tag (u must consider lock
> other than what u type earlier)
> anyway.. using a table is a good idea.. actualy if your client type using
> table.. what should u do??
> ----- Original Message -----
> From: "itoctopus"
> To:
> Sent: Tuesday, May 08, 2007 7:26 AM
> Subject: [PHP-DB] Re: Read more link with HTML code
>
>
>
>> Put your 200 characters in a table block:
>>
>>
>>
>> Your 200 characters
>> |
>>
>>
>>
>> --
>> itoctopus - http://www.itoctopus.com
>> "Mike van Hoof" wrote in message
>> news:463F0D50.9010803@medusa.nl...
>>
>>> Hello list,
>>>
>>> I got a problem with displaying content in a "read more block" which
>>> contains HTML code.
>>> The problem is as followes:
>>>
>>> I got a large piece of content, which contains HTML code (
>>>
> etc),
>
>>> but after 200 characters a read more link appears. At the moment I strip
>>> al the HTML out of this piece of content, and display the full set off
>>> content on another page.
>>> But now i also want to display the bold text etc. in the first (200
>>>
> chrs)
>
>>> content block. The only problem i have here, is that when I got a bold
>>>
> tag
>
>>> opend in the first 200 chrs, and it's closed after 400 chrs, then the
>>>
> rest
>
>>> off the page is also bold.
>>>
>>> somebody got a solution ?
>>>
>>> Thanks for reading.
>>>
>>> Mike
>>>
>>> --
>>> Medusa, Media Usage Advice B.V.
>>> Science Park Eindhoven 5216
>>> 5692 EG SON
>>> tel: 040-24 57 024 fax: 040-29 63 567
>>> url: www.medusa.nl
>>> mail: mike@medusa.nl
>>>
>>> Uw bedrijf voor Multimedia op Maat
>>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
--------------020407050801050007000306--
Re: Read more link with HTML code
am 08.05.2007 09:28:48 von dmagick
Mike van Hoof wrote:
> Hello list,
>
> I got a problem with displaying content in a "read more block" which
> contains HTML code.
> The problem is as followes:
>
> I got a large piece of content, which contains HTML code (
> etc), but after 200 characters a read more link appears. At the moment I
> strip al the HTML out of this piece of content, and display the full set
> off content on another page.
> But now i also want to display the bold text etc. in the first (200
> chrs) content block. The only problem i have here, is that when I got a
> bold tag opend in the first 200 chrs, and it's closed after 400 chrs,
> then the rest off the page is also bold.
You could try using http://php.net/substr_count and do something like:
$tags = array('', '', '');
foreach ($tags as $p => $tag) {
$count = substr_count($string, $tag);
if ($count % 2 != 0) {
echo "Found a mismatch for tag " . htmlentities($tag) . "
";
}
}
Not a great solution because you're hardcoding the tags you're looking
for but there aren't that many that change text appearances like these
do (but then again this method won't work for
you can place styles inside those tags)....
Unless you want to get into regex'es....
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Read more link with HTML code
am 08.05.2007 09:31:14 von dmagick
Chris wrote:
> Mike van Hoof wrote:
>> Hello list,
>>
>> I got a problem with displaying content in a "read more block" which
>> contains HTML code.
>> The problem is as followes:
>>
>> I got a large piece of content, which contains HTML code (
>> etc), but after 200 characters a read more link appears. At the moment
>> I strip al the HTML out of this piece of content, and display the full
>> set off content on another page.
>> But now i also want to display the bold text etc. in the first (200
>> chrs) content block. The only problem i have here, is that when I got
>> a bold tag opend in the first 200 chrs, and it's closed after 400
>> chrs, then the rest off the page is also bold.
>
> You could try using http://php.net/substr_count and do something like:
>
> $tags = array('', '', '');
> foreach ($tags as $p => $tag) {
> $count = substr_count($string, $tag);
> if ($count % 2 != 0) {
> echo "Found a mismatch for tag " . htmlentities($tag) . "
";
> }
> }
>
> Not a great solution because you're hardcoding the tags you're looking
> for but there aren't that many that change text appearances like these
> do (but then again this method won't work for
> you can place styles inside those tags)....
>
> Unless you want to get into regex'es....
Actually that's not going to work at all.
You'd have to do something like:
$open_tags = array('', '', '');
$close_tags = array('', '', '');
foreach ($open_tags as $p => $tag) {
$open_count = substr_count($string, $tag);
$close_count = substr_count($string, $close_tags[$p]);
if ($open_count != $close_count) {
echo "Mismatch for tag " . htmlentities($tag) . "
";
}
}
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Read more link with HTML code
am 08.05.2007 09:36:52 von Mike van Hoof
Hey,
thanks for the help everyone, but after reading all the answers i
decided to do some regexp thingies. Came up with this:
function readMore_closedtags($text, $length) {
preg_match_all('/<(.*?)>/s',substr(stripslashes($text), 0,
$length),$out);
foreach($out[1] as $key2 => $val2){
if(
!preg_match("/br.*/", $val2) &&
!empty($val2)
){
$val2_arr = explode(" ", $val2);
$val2 = $val2_arr[0];
if(preg_match("/^\//", $val2))
$html_arr_close[] = strtolower($val2);
else
$html_arr_open[] = strtolower($val2);
}
}
$not_closed_tags = array();
foreach($html_arr_open as $tag){
$key = array_search("/" . $tag, $html_arr_close);
if($key !== false){
unset($html_arr_close[$key]);
} else {
$not_closed_tags[] = $tag;
}
}
$closed_tags_str = '';
foreach($not_closed_tags as $tag){
$closed_tags_str .= "" . $tag . ">";
}
return $closed_tags_str;
}
Mike
Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024
fax: 040-29 63 567
url: www.medusa.nl
mail: mike@medusa.nl
Uw bedrijf voor Multimedia op Maat
Mike van Hoof schreef:
> Hello:
>
> EG:
>
> The community of Gbongay, Sierra Leone, suffered greatly after the
> country's civil war, and had aspirations of starting a beekeeping
> operation to improve their situation. That's when they turned to
> NABUUR for assistance. But with Neighbours living all over the world
> and a Facilitator with no knowledge of bees, could this dream ever
> become a reality?
The challenge
Gbongay, a
> rural village situated in southeast Sierra Leone, lost everything
> after the civil war -- the school and hospital were destroyed, and its
> inhabitants no longer had access to safe water. To try to overcome
> this tragedy, the community decided it needed to raise money, which
> could be used to create a small, sustainable business.
> />Beekeeping seemed to be a promising option, since it required only a
> small investment and had the potential for a high return -- and the
> proof was in the neighbouring village, which already had a successful
> honey business.
A real leader
What really got
> this project started was the project's Facilitator, Raul Alberto
> Caceres. Born in Colombia, Raul moved to Australia for a post-graduate
> programme. He now works as a chemical engineer
in the food
> industry and recently joined NABUUR.
As the leader of the
> beekeeping project, Raul designed a detailed plan. He knew they needed
> to research as much as possible about starting and running a
> beekeeping operation, and that the assistance of the
Neighbours
> was going to be essential.
The Neighbours -- from more than
> ten countries -- were involved at different stages of the project
> depending on their expertise. Some
volunteers helped with general
> tasks, like Internet research, letter writing and contacting
> organisations for information, while others helped with more specific
> assignments that pertained to beekeeping
itself.
> />Quick success
Gbongay's beekeeping operation progressed
> quickly -- and it couldn't have been done without Raul's impressive
> leadership abilities. He showed enthusiasm on the website and was able
> to mobilise
volunteers all over the world, including Turkey,
> Ghana, Canada and the Netherlands. Because NABUUR volunteers often
> never have the chance to meet in person, it's essential that a
> project's Facilitator be an organised and enthusiastic leader.
> Fortunately for the community of Gbongay, Raul was just that!
> />Beekeeping today
> src="http://www.nabuur.com/uploads/img_4512900141172.jpg"
> align="right" hspace="15" alt="" />The beekeeping operation in Gbongay
> has further expanded and now includes a beekeeping school. After some
> research, the Neighbours and local community decided this would be a
> great way to
ensure the future of the beekeeping business. In
> March 2006, everyone began work on the school.
Today,
> things are looking better for the village of Gbongay. The community's
> first water pump has been installed, the first 35 beekeepers have
> graduated from the new school -- and, best of all,
the first
> customers are buying honey!
Bonus
"Gbongay has
> been rewarded by nature. It was
given the local bee, which is
> extremely prolific, an
abundance of bee flora and a favourable
> climate
for beekeeping -- making this initiative a lucrative
> />one."
Mariama Fawundu, Local Representative
>
>
> With kind regards
>
> Mike
>
> Medusa, Media Usage Advice B.V.
> Science Park Eindhoven 5216
> 5692 EG SON
> tel: 040-24 57 024 fax: 040-29 63 567
> url: www.medusa.nl
> mail: mike@medusa.nl
>
> Uw bedrijf voor Multimedia op Maat
>
>
>
> Rafael Costa Pimenta schreef:
>> could you show some example?
>>
>> 2007/5/7, Mike van Hoof >:
>>
>> Hello list,
>>
>> I got a problem with displaying content in a "read more block" which
>> contains HTML code.
>> The problem is as followes:
>>
>> I got a large piece of content, which contains HTML code (
>> etc), but after 200 characters a read more link appears. At the
>> moment I
>> strip al the HTML out of this piece of content, and display the
>> full set
>> off content on another page.
>> But now i also want to display the bold text etc. in the first (200
>> chrs) content block. The only problem i have here, is that when I
>> got a
>> bold tag opend in the first 200 chrs, and it's closed after 400
>> chrs,
>> then the rest off the page is also bold.
>>
>> somebody got a solution ?
>>
>> Thanks for reading.
>>
>> Mike
>>
>> --
>> Medusa, Media Usage Advice B.V.
>> Science Park Eindhoven 5216
>> 5692 EG SON
>> tel: 040-24 57 024
>> fax: 040-29 63 567
>> url: www.medusa.nl
>> mail: mike@medusa.nl
>>
>> Uw bedrijf voor Multimedia op Maat
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>> --
>> Atenciosamente,
>> Rafael C. Pimenta
>> Programador - CTT Integration Group
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php